<?php

class Application_Model_Goods extends Application_Model_DomainObject {
	protected $_id;
    protected $_title;
    protected $_picurl;
    protected $_price;
    protected $_cost;
    protected $_menuid;
    protected $_url;
    protected $_volume;
    
       public static function getAll($condition = array())
    {
        if(!is_array($condition)){
            return false;
        }
        return self::getDao()->queryAll($condition);
    }
    public static function getFilter($parentId,$pagesize,$pageindex)
    {
        return self::getDao()->queryPage(array("menuid = "=>$parentId), " id asc ", $pagesize, $pageindex);
    }
 /**
     * 添加
     */
    public static function add($goods,$menuid)
    {
        $hot = new Application_Model_Goods();
        $hot->title = $goods['title'];
        $hot->url = $goods['item_url'];
        $hot->price = $goods['zk_final_price'];
        $hot->picurl = $goods['pict_url'];
        $hot->menuid = $menuid;
        $hot->cost = $goods['reserve_price'];   
        $hot->volume = $goods['volume'];    
        $hot->save();
        return $hot->Id;
    }

     public function edit($title, $url, $cost, $picurl, $price) {
        $this->_title = $title;
        $this->_url = $url;
        $this->_price = $price;
        $this->_picurl = $picurl;
        $this->_cost = $cost;
        $this->save();
    }
        

}